<!doctype html>
<html>
	<head>
  		<meta charset="utf-8">
      	<meta http-equiv="X-UA-Compatible" content="IE=edge">
      	<meta name="viewport" content="width=device-width, initial-scale=1">
      	<title>{$goodsDetails["goodsName"]} - {$CONF['mallTitle']}</title>
      	<meta name="keywords" content="{$goodsDetails['goodsKeywords']}" />
      	<meta name="description" content="{$goodsDetails['goodsName']},{$CONF['mallDesc']}" />
      	<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/common.css" />
     	<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/goodsdetails.css" />
     	<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/base.css" />
		<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/head.css" />
		<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/pslocation.css" />
		<link rel="stylesheet" href="__ROOT__/Apps/Home/View/default/css/magnifier.css" />
     	<script src="__PUBLIC__/js/jquery.min.js"></script>
     	<script src="__PUBLIC__/js/common.js"></script>
     	<script src="__PUBLIC__/plugins/layer/layer.min.js"></script>
     	<style type="text/css">
     		.cmt-edit {background: #f5f5f5;}
     		.cmt-edit-top {padding: 10px 10px 2px;}
     		.cmt-user {
			    float: left;
			    width: 60px;
			    height: 60px;
			}
			.cmt-user img {
			    display: block;
			    max-width: 100%;
			}
			fieldset, img {
			    border: 0;
			}
			.cmt-add {
			    float: left;
			    margin: 0 0 5px 10px;
			    width: 630px;
			    height: 50px;
			    padding: 4px;
			    border: 1px solid #ababab;
			    background: #fff;
			}
			.cmt-add textarea {
			    border: 0;
			    border-width: 0;
			    overflow: auto;
			    word-wrap: break-word;
			    width: 100%;
			    height: 40px;
			    line-height: 20px;
			    outline: 0;
			}
			.cmt-edit-btm { padding: 0 10px 10px;}
			.cmt-send-el { float: right;color: #747474;margin-right: 90px;}
			.cmt-send-el0 { float: right;color: #747474;margin-right: 50px;}
			.cmt-send-textnum {padding-right: 5px; font-size: 12px;}
			.cmt-send-btn {
			    display: inline-block;
			    width: 43px;
			    height: 24px;
			    line-height: 24px;
			    text-decoration: none;
			    color: #000;
			    font-size: 12px;
			    font-weight: 400;
			    padding: 0;
			    text-align: center;
			    border: 1px solid #ababab;
			    background: #ccc;
			    background: -webkit-gradient(linear,left top,left bottom,from(#fff),to(#e5e5e5));
			}

			/***/
			.cmt-item {
    position: relative;
    border-top: 1px dashed #d5d5d5;
    padding: 10px 0;
}
			.cmt-reply-user {
    display: block;
    float: left;
    width: 30px;
    height: 30px;
}			
			.cmt-reply-user img {
    display: block;
    max-width: 100%;
}
	.cmt-cont-wrap {
    position: relative;
    padding-left: 50px;
}
	.cmt-cont {
    margin: -2px 0 0;
    color: #666;
    word-break: break-all;
    word-wrap: break-word;
}
	.cmt-user-name {
    margin-right: 5px;
}
	.cmt-date {
    color: #acacac;
}
	.cmt-reply-btn {
    position: absolute;
    right: 35px;
    bottom: 0;
    color: #369103;
    cursor: pointer;
}	
	.cmt-item .cmt-edit {
    display: none;
}
     	</style>
   	</head>
   	<body>
		<include file="./Apps/Home/View/default/header_common.html" />
		<input id="shopId" type="hidden" value="{$goodsDetails['shopId']}"/>
		<input id="goodsId" type="hidden" value="{$goodsDetails['goodsId']}"/>
		<!----加载商品楼层start----->
		<div class="wst-container">
			<div class="wst-nvg-title">
				<a href="{:U('Home/Goods/getGoodsList/',array('c1Id'=>$goodsNav[0]['catId']))}">{$goodsNav[0]["catName"]}</a>&nbsp;>&nbsp;
				<a href="{:U('Home/Goods/getGoodsList/',array('c1Id'=>$goodsNav[0]['catId'],'c2Id'=>$goodsNav[1]['catId']))}">{$goodsNav[1]["catName"]}</a>&nbsp;>&nbsp;
				<a href="{:U('Home/Goods/getGoodsList/',array('c1Id'=>$goodsNav[0]['catId'],'c2Id'=>$goodsNav[1]['catId'],'c3Id'=>$goodsNav[2]['catId']))}">{$goodsNav[2]["catName"]}</a>
			</div>
			<div class="wst-goods-details">
				<div class="details-left">
					<div class="goods-img-box">
						 <!--产品参数开始-->
						  <div>
						    <div id="preview" class="spec-preview"> 
							    <span class="jqzoom">
							    	<img jqimg="__ROOT__/{$goodsDetails['goodsImg']}" src="__ROOT__/{$goodsDetails['goodsImg']}" height="350" width="350"/>
							    </span> 
						    </div>
						    <!--缩图开始-->
						    <div class="spec-scroll"> <a class="prev">&lt;</a> <a class="next">&gt;</a>
						      <div class="items">
						        <ul>
						        	<li><img alt="" bimg="__ROOT__/{$goodsDetails['goodsImg']}" src="__ROOT__/{$goodsDetails['goodsImg']}" onmousemove="preview(this);"></li>
						        	<volist name="goodsImgs" key="k" id="vo">
						          		<li><img alt="" bimg="__ROOT__/{$vo['goodsImg']}" src="__ROOT__/{$vo['goodsImg']}" onmousemove="preview(this);"></li>
						          	</volist>
						        </ul>
						      </div>
						    </div>
						    <!--缩图结束-->
						  </div>
						  <!--产品参数结束-->
						  <div class='wst-short-tool'>
						       <div style='float:left;'>商品编号：{$goodsDetails["goodsSn"]}</div>
						       <div style='float:right;'>
						         <a href='javascript:favoriteGoods({$goodsDetails['goodsId']})'>
						         <b></b>
						         <span id='f0_txt' f='{$favoriteGoodsId}'>
						         <if condition="$favoriteGoodsId gt 0">已关注<else/>关注商品</if>
						         </span>
						         </a>
						       </div>
						  </div>
					</div>
					<div class="goods-des-box">
						<table class="goods-des-tab">
							<tbody>
								<tr>
									<td colspan="2">
										<div class="des-title" style="word-break:break-all;">
											{$goodsDetails["goodsName"]}
											</div>
										<div class='wst-goods-spec'>{$goodsDetails["goodsSpec"]|htmlspecialchars_decode}</div>
									</td>
								</tr>
								
								<tr>
									<td width="70" ><div class="underline-chux" style="height:20px;">
										<span class="">转让价格：</span></div></td>
									
									
									<td><div class="underline-chux" style="height:20px;">
										<span style="font-weight: 600;color: #fb4f1c; font-size:22px;" id='shopGoodsPrice_{$goodsDetails["goodsId"]}' dataId='{$goodsDetails["goodsAttrId"]}'><span style="color:#999999;">￥</span>{$goodsDetails["shopPrice"]}</span>
										<span style="color:#999999;font-weight: 600; font-size:16px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											 <sup>原价：￥<del>{$goodsDetails["marketPrice"]}</del></sup>
										</span>
										</div>
									</td>
									
								</tr>
								

								<tr>
									<td width="70"><span class="des-title-span">成&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;色：</span></td>
									
									<if condition='$goodsDetails["oldAndNew"] eq 1 '>
										<td>全新</td>
										<else />
										<td>非全新</td>
									</if>
									
								</tr>
								<tr>
									<td width="70"><span class="des-title-span">讲&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;价：</span></td>
									
									<if condition='$goodsDetails["bargain"] eq 1 '>
										<td><span style="color: #c1e358;font-size: 14px;"><b>允许</b></span></td>
										<else />
										<td><span style="color: #fc0;font-size: 14px;"><b>拒绝</b></span></td>
									</if>
									
								</tr>
								<tr style="">
									<td width="70"><span class="des-title-span">所&nbsp;&nbsp;在&nbsp;地：</span></td>
									<td>{$userData['areaName']}</td>
								</tr>
								<tr>
									<!--这里对联系方式 进行遮掩，非会员 无法看到-->
									<td width="70"><span class="des-title-span">联系方式：</span></td>
									<td><div id="lianxi_title" style="background: url('__ROOT__/Apps/Home/View/default/images/lxfsbj.png') no-repeat;background-size:100% 100%;-moz-background-size:100% 100%;-webkit-background-size:100% 100%;width:90px;height:28px;">
										<a href="javascript:showdizhi()" class="btn2Cart">
										<img src="__ROOT__/Apps/Home/View/default/images/lianxifanshi.png" style="width:90px;height:26px;" /></a>
										</div>
										<div id="sellerDiv" style="font-size:13px;width:180px;height:54px;display:none; background-color: rgb(220, 250, 125);">
											<eq name="userLogin" value="true">
												<div style="padding: 10px;">
													<b>联系人</b>：{$goodsDetails["sellerName"]}<br/>
													<b>手机号</b>：{$goodsDetails["phone"]} <br/> 
												</div>
											<else/>
												<div style="padding: 10px;">
													<b>请登录后查看</b>
												</div>
											</eq>
											
										</div>
										</td>
								</tr>
								<tr>
									<td width="70"><span class="des-title-span">交易方式：</span></td>
									<td>线下交易</td>
								</tr>
								

								<!--删除 下面的配送至 -->
								<tr style="display:none;">
									<td width="70"><span class="des-title-span">配送至：</span></td>
									<td>
										<li id="summary-stock">
											<div class="dd">
												<div id="store-selector">
													<div class="text">
														<div></div>
														<b></b>
													</div>
												</div><!--store-selector end-->
												<div id="store-prompt">
													<strong></strong>
												</div>
												<!--store-prompt end -->
											</div>
										</li>
										<div class="wst-clear"></div>
									</td>
								</tr>

								<!--删除 下面的运费 -->
								<tr style="display:none;">
									<td width="70"><span class="des-title-span">运费：</span></td>
									<td>{$goodsDetails["deliveryStartMoney"]}元起，配送费{$goodsDetails["deliveryMoney"]}元，{$goodsDetails["deliveryFreeMoney"]}元起免配送费</td>
								</tr>
								<!--删除 下面的服务 -->
								<tr style="display:none;">
									<td width="70"><span class="des-title-span">服务：</span></td>
									<td>由
									<if condition="$goodsDetails['deliveryType'] eq 1">
										{$CONF['mallName']}
									<else/>
										<a href="{:U('Home/Shops/toShopHome/',array('shopId'=>$goodsDetails['shopId']))}">{$goodsDetails['shopName']}</a>
									</if>
									配送，并提供售后服务</td>
								</tr>
								<if condition=" count($goodsAttrs['priceAttrs']) gt 0">
								<tr style='height:15px;border-top:1px dashed #ddd;'>
								   <td colspan='2'></td>
								</tr>
								<tr>
									<td width="70"><span class="des-title-span">{$goodsAttrs["priceAttrName"]}：</span></td>
									<td>
									 <volist name="goodsAttrs['priceAttrs']" id="avo">
									 <span class='wst-goods-attrs <if condition=" $goodsDetails['goodsAttrId'] eq $avo['id']">wst-goods-attrs-on</if>' dataId='{$avo["id"]}' onclick='javascript:checkStock(this)'>{$avo['attrVal']}</span>
									 </volist>
									</td>
								</tr>
								</if>
								<tr>
								    <td></td>
								    <td></td>
								</tr>

								<!--删除 下面的购买数量 -->
								<if condition="$goodsDetails['shopServiceStatus'] eq 1">
								<tr style="display:none;">
									<td width="70"><span style="display:inline-block;width:70px;">购买数量：</span></td>
									<td>
										<div id="haveGoodsToBuy" <if condition="$goodsDetails['goodsStock'] elt 0">style="display:none;"</if>>
											<div class="goods-buy-cnt">
												<div class="buy-cnt-plus" onclick="changebuynum(1)"></div>
												<input id="buy-num" type="text" class="buy-cnt-txt" value="1" maxVal="{$goodsDetails['goodsStock']}" maxlength="3" onkeypress="return WST.isNumberKey(event);" onkeyup="changebuynum(0);" autocomplete="off"/>
												<div class="buy-cnt-add" onclick="changebuynum(2)"></div>
											</div>
											<div class='wst-goods-stock'>库存：<span id='goodsStock'>{$goodsDetails['goodsStock']}</span>{$goodsDetails['goodsUnit']}</div>
										</div>
										<div id="noGoodsToBuy" <if condition="$goodsDetails['goodsStock'] gt 0">style="display:none;"</if>>
											<div style="font-weight: bold;">所选地区该商品暂时无货，非常抱歉！</div>
											<div style="clear: both;"></div>
											<br />
											<div>
												<a id="InitCartUrl" class="btn-append " href="javascript:void(0);" title="">
													<span>
														<img src="__ROOT__/Apps/Home/View/default/images/hcat.jpg" />
													</span>
												</a>
											</div>
										</div>
									</td>
								</tr>
								<else/>
								<tr>
									<td colspan="2">
										<div class="wst-gdetail-wait">休息中,暂停营业</div>
									</td>
								</tr>
								</if>
								<!-- 去掉 -->
								<tr style="display:none;">
									<td style="position: relative;">
									<div id='qrBox' style='position:absolute ;top:-50px;left:450px;padding:2px;'>
										<div id='qrcode' style='width:132px;height:132px;border:1px solid #ddd;margin-bottom:2px;'></div>
										<div>下载移动客户端扫一扫</div>
									</div>
									</td>
									<td></td>
								</tr>

								<if condition="$goodsDetails['goodsStock'] gt 0">
								<tr>
									<td width="70"></td>
									<td>
										<if condition="$comefrom eq 1">
											<img src="__ROOT__/Apps/Home/View/default/images/hcat.jpg" />
										<else/>
											<php>if($goodsDetails['shopServiceStatus'] ==1){</php>
												<!-- 删除 加入购物车-->
												<a style="display:none;" href="javascript:addCart({$goodsDetails['goodsId']},0,'{$goodsDetails['goodsThums']}')" class="btnCart"><img src="__ROOT__/Apps/Home/View/default/images/btn_buy_01_hover.png" width="112" height="38"/></a>
												&nbsp;&nbsp;
												<a style="display:none;" href="javascript:addCart({$goodsDetails['goodsId']},1)" class="btn2Cart">
													<img src="__ROOT__/Apps/Home/View/default/images/btn_buy_02.png" width="112" height="38"/>
												</a>
											<php>}else if($goodsDetails['shopServiceStatus'] ==0){</php>
											
												<img src="__ROOT__/Apps/Home/View/default/images/hcat.jpg" />
											<php>}</php>
										</if>
									</td>
								</tr>
								</if>
							</tbody>
						</table>
						
					</div>
				</div>

				<!--暂时去掉商家信息-->
				<div style="display:none;" class="details-right">
					<table class="details-tab">
						<tbody>
							<tr>
								<td class="title">店铺名称：</td>
								<td>{$goodsDetails["shopName"]}</td>
							</tr>
							<tr>
								<td class="title">营业时间：</td>
								<td>{$goodsDetails['serviceStartTime']}-{$goodsDetails['serviceEndTime']}</td>
							</tr>
							<tr>
								<td class="title">配送说明：</td>
								<td>{$goodsDetails["deliveryStartMoney"]}元起，配送费{$goodsDetails["deliveryMoney"]}元<br/>{$goodsDetails["deliveryFreeMoney"]}元起免配送费<br/><br/></td>
							</tr>
							<tr>
								<td class="title">店铺地址：</td>
								<td>{$goodsDetails['shopAddress']}</td>
							</tr>
							<tr>
								<td class="title">店铺电话：</td>
								<td>{$goodsDetails['shopTel']}</td>
							</tr>
							<if condition="$goodsDetails['qqNo'] neq ''">
							<tr>
								<td class="title">&nbsp;QQ咨询：</td>
								<td>
									<a href="tencent://message/?uin={$goodsDetails['qqNo']}&Site=QQ交谈&Menu=yes">
									<img border="0" src="http://wpa.qq.com/pa?p=1:{$goodsDetails['qqNo']}:7" alt="QQ交谈" width="71" height="24" />
									</a><br/>
								</td>
							</tr>
							</if>
							<tr>
								<td ></td>
								<td></td>
							</tr>
							<tr>
								<td colspan="2" class="wst-shop-eval">
									<div class="shop-eval-box" style="width:220px;margin:0 auto;">
										    <li>商品<br/>{$shopScores["goodsScore"]}</li>
											<li class="li-center">时效<br/>{$shopScores["timeScore"]}</li>
											<li>服务<br/>{$shopScores["serviceScore"]}</li>
										<div class="wst-clear"></div>
									</div>
								</td>
							</tr>
							<tr>
								<td ></td>
								<td></td>
							</tr>
							<tr>
								<td colspan="2" class="wst-shop-eval">
									<div class="shop-eval-box" style="width:214px;margin:0 auto;">
										<a class='wst-shop-btn' href="{:U('Home/Shops/toShopHome/',array('shopId'=>$goodsDetails['shopId']))}">
										进入店铺
										</a>
										<a class='wst-shop-btn' href="javascript:favoriteShops({$goodsDetails['shopId']})">
										<span id='f1_txt' f='{$favoriteShopId}'><if condition="$favoriteShopId gt 0">已关注<else/>关注店铺</if></span>
										</a>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="wst-clear"></div>
			</div>
			
			<div class="wst-goods-pdetails">
				<div class="wst-goods-pdetails-left">
					<!--
					{:W('Goods/getHotGoods',array('shopId'=>$goodsDetails['shopId']))}
					-->
					{:W('Goods/getViewGoods')}
				</div>
				<div id="wst-goods-pdetails-right" class="wst-goods-pdetails-right">
					<div class="goods-nvg">
						<ul class="tab">
							<li onclick="tabs('#wst-goods-pdetails-right',0)" class="curr">宝贝介绍</li>
							<if condition=" count($goodsAttrs['attrs']) gt 0">
							<li onclick="tabs('#wst-goods-pdetails-right',1)">商品属性</li>
							<li onclick="tabs('#wst-goods-pdetails-right',2)">留言</li>
							<else/>
							<li onclick="tabs('#wst-goods-pdetails-right',1)">留言</li>
							</if>
						</ul>
						<div class="wst-clear"></div>
					</div>
					<div class="tabcon">
						<div id="wst_goods_desc" style="font-weight:bolder;height:auto;line-height:30px;padding-left:8px;">
						{$goodsDetails["goodsDesc"]}
						</div>
					</div>
					<if condition=" count($goodsAttrs['attrs']) gt 0">
					<div class="tabcon" style="display:none;">
						<table class='wst-attrs-list'>
						  <volist name="goodsAttrs['attrs']" id="vo">
						  <if condition="$vo['attrContent'] !='' ">
						  <tr>
						    <th nowrap>{$vo['attrName']}：</th>
						    <td>{$vo['attrContent']}</td>
						  </tr>
						  </if>
						  </volist>
						</table>
					</div>
					</if>
					<div class="tabcon"  style="display:none;">
				        <div class="cmt-edit-wrap">
						    <div class="cmt-edit" >
						        <div class="cmt-edit-top clearfix">
						            <div class="cmt-user">
						                <img src="__ROOT__/Apps/Home/View/default/images/2674228161.jpg" alt="">
						            </div>
						            <div class="cmt-add">
						                <textarea id="content" placeholder="我也插句话..."></textarea>

						            </div>

						        </div>
						        <div class="cmt-edit-btm clearfix">
						            <span class="cmt-send-el">
						                <em id="contenttextnum" class="cmt-send-textnum">0/140</em>
						                <button id="comment"  class="cmt-send-btn">评论</button>
						            </span>
						        </div>
						    </div>
						</div>					
						<table id="appraiseTab" width="90%">
							<tr>
								<td>

		                   
		                        </td>
		                	</tr>
							<tr>
								<td>
		                      	 	<div style="margin-top: 10px;" id="allgoodsppraises">
		                           		 请稍等...
		                        	</div>
		                        </td>
		                	</tr>
	                   	</table>  
	                   	<div id="wst-page-items" style="text-align:center;margin-top:5px;"></div>                  
					</div>
					<div class="wst-clear"></div>
				</div>
				<div class="wst-clear"></div>
			</div>
			<div class="wst-clear"></div>
		</div>
		<include file="./Apps/Home/View/default/footer.html" />
		<include file="./Apps/Home/View/default/right_cart.html" />
   	</body>
   	
<script src="__ROOT__/Apps/Home/View/default/js/goods.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__ROOT__/Apps/Home/View/default/js/head.js" type="text/javascript"></script>
<script src="__ROOT__/Apps/Home/View/default/js/common.js" type="text/javascript"></script>
<script src="__ROOT__/Apps/Home/View/default/js/pslocation.js" type="text/javascript"></script>
<script src="__ROOT__/Apps/Home/View/default/js/jquery.jqzoom.js" type="text/javascript"></script>

<script src="__ROOT__/Apps/Home/View/default/js/magnifier.js" type="text/javascript"></script>
<!--
<script src="__PUBLIC__/js/qrcode.js"></script>
-->
<script> 
$("#store-selector").hover(function() {
}, function(){
	$("#store-selector").removeClass("hover");
});

var RespondTab = false;

$(function(){

	getGoodsappraise({$goodsDetails["goodsId"]},0);
	$("#wst_goods_desc img").each(function(){
		if($(this).width()>940){
			$(this).width(940);
		}
	});

	//输入文字 内容改变事件
	$('#content').on('input propertychange', function() {
	    $('#contenttextnum').html($(this).val().length + '/140');
	    //$(this).children(".cmt-send-textnum").html($(this).val().length + '/140');
	});

	//输入文字 内容改变事件
	$(document).on('input propertychange','#rcontent', function() {
		var id = document.querySelector('#rcontent').dataset.ids;
	    $('#rtextnum'+id).html($(this).val().length + '/140');
	});
});




//
$('#comment').bind("click", function() {
	//获得内容
	var content = $('#content').val();
	
	//验证内容
	if($('#content').val().length<141 && content!='' && content!=undefined && content!=null ){
		var params = {};
		params.toUserId = {$goodsDetails["userId"]};
		params.goodsId = {$goodsDetails["goodsId"]};
		params.content = content;
		params.parentId = 0;
		//alert(JSON.stringify(params));
		addLetter(params);
	}
	else {
		 WST.msg('留言字数 违反限制！请检查', {icon: 5,time:2500});
	}
  
});

function RemoveRespond(pointer){
	$("#"+pointer).html('');
	RespondTab = false;
}

function addRespond(element,userName,parentId,goodsId){
	//alert(element.dataset.pointer);
	if(!RespondTab){
			var html = new Array();
		//html.push('<div class="">');
			html.push('<div class="cmt-edit-top clearfix">');
				html.push('<div class="cmt-user">  <img src="__ROOT__/Apps/Home/View/default/images/2674228161.jpg" alt=""> </div>');
				html.push('<div class="cmt-add" style="width:530px;">  <textarea id="rcontent" class="rcontents" placeholder="回复'+userName+'" data-ids="'+parentId+'" ></textarea> </div>');
				html.push('<a title="关闭" href="javascript:RemoveRespond(\''+element.dataset.pointer+'\')" style="background-image: url(__ROOT__/Apps/Home/View/default/images/close_bottons.png); background-size: 100%;width: 25px; height: 25px; display: block; float: right;margin-right: 20px;"></a>');
			html.push('</div>');
			html.push('<div class="cmt-edit-btm clearfix"> <span class="cmt-send-el0"> <em id="rtextnum'+parentId+'"   class="cmt-send-textnum">0/140</em> <button  class="cmt-send-btn" onclick="Respond('+parentId+','+goodsId+')">评论</button> </span> </div>');
		//html.push('</div>');

		$("#"+element.dataset.pointer).html(html);
		RespondTab = true;
	}else{
		WST.msg('请先完成已打开的回复!', {icon: 5});
	}



}

function Respond(parentId,goodsId) {
    //alert($("#rcontent").val());
		//获得内容
	var content = $('#rcontent').val();
	
	//验证内容
	if($('#rcontent').val().length<141 && content!='' && content!=undefined && content!=null ){
		var params = {};
		params.toUserId = {$goodsDetails["userId"]};
		params.goodsId = {$goodsDetails["goodsId"]};
		params.content = content;
		params.parentId = parentId;

		addLetter(params);
	}
	else {
		 WST.msg('留言字数 违反限制！请检查', {icon: 5,time:2500});
	}


}

function addLetter(params){
		jQuery.post(Think.U("Home/GoodsAppraises/addGoodsAppraises") ,params,function(data){
			var json = WST.toJson(data);
			if(json.status=='1'){
				WST.msg('操作成功!', {icon: 1},function(){
					getGoodsappraise({$goodsDetails["goodsId"]},0);
				});
				$('#content').val('');
				//alert(JSON.stringify(data));
			} else if (json.status=='-888'){
				WST.msg('请先登录后，再留言!', {icon: 5});
				//alert(JSON.stringify(data));
			} else {
				WST.msg('操作失败!', {icon: 5});
				//alert(JSON.stringify(data));
			}
		});
}
function getGoodsappraise(goodsId,p){
	var params = {}; 
	params.goodsId = goodsId;
	params.p = p;
	//加载商品评价
	jQuery.post(Think.U("Home/GoodsAppraises/getGoodsappraises") ,params,function(data) {
		var json = WST.toJson(data);
		if(json.root && json.root.length){
			var html = new Array();		    	
			for(var j=0;j<json.root.length;j++){
			    var appraises = json.root[j];	
			   	
			    	html.push('<div class="cmt-item clearfix" data-touserid="'+appraises.toUserId+'" data-nick="'+appraises.toUserName+'" data-userid="'+appraises.userId+'">');
			    	html.push('<a href="javascript:;" target="_blank" class="cmt-reply-user"> <img src="__ROOT__/Apps/Home/View/default/images/2674228161.jpg" alt=""> </a>');
			    	html.push('<div class="cmt-cont-wrap">');	
			    	if(appraises.parentId==0){
			    		html.push('<p class="cmt-cont"> <span class="cmt-user-name">'+appraises.userName+'</span> <span class="cmt-cont-text">'+appraises.content+'</span> </p>');
			    	} else{
			    		html.push('<p class="cmt-cont"> <span class="cmt-user-name">'+appraises.userName+'</span>回复<span class="cmt-user-name">'+appraises.toUserName+' : </span><span class="cmt-cont-text">'+appraises.content+'</span> </p>');
			    	}
			    	
			    	html.push('<p class="cmt-date">'+appraises.createTime+'</p>');
			    	html.push('<span class="cmt-reply-btn respond" data-pointer="respond_'+appraises.id+'" onclick="addRespond(this,\''+appraises.userName+'\','+appraises.id+','+goodsId+')">回复</span>');
			    	html.push('</div></div>');
			    	html.push('<div id="respond_'+appraises.id+'" class="cmt-edit" style="padding-left: 50px;" ></div>')
			}
			$("#appraiseTab").html(html.join(""));
			if(json.totalPage>1){
				laypage({
				    cont: 'wst-page-items',
				    pages: json.totalPage,
				    curr: json.currPage,
				    skip: true,
				    skin: '#e23e3d',
				    groups: 3,
				    jump: function(e, first){
				        if(!first){
				        	getGoodsappraises(goodsId,e.curr);
				        }
				    }
				});
			}
		}else{
			$("#appraiseTab").html("<tr><td><div style='font-size:15px;text-align:center;'>没有评价信息</div></td></tr>");
		}	
	});
}

function showdizhi(){
  $("#lianxi_title").animate({width:'140px',paddingLeft:'40px'});
  $("#sellerDiv").slideDown();
}

</script>
   	
</html>


